#import "~/graphql_shared/fragments/author.fragment.graphql"
#import "~/graphql_shared/fragments/label.fragment.graphql"
#import "~/graphql_shared/fragments/page_info.fragment.graphql"

query projectIssues(
  $projectPath: ID!
  $types: [IssueType!]
  $state: IssuableState
  $authorUsername: String = ""
  $labelName: [String]
  $search: String = ""
  $sortBy: IssueSort = created_desc
  $firstPageSize: Int
  $lastPageSize: Int
  $prevPageCursor: String = ""
  $nextPageCursor: String = ""
) {
  project(fullPath: $projectPath) {
    id
    name
    issueStatusCounts(
      types: $types
      authorUsername: $authorUsername
      labelName: $labelName
      search: $search
    ) {
      opened
      closed
      all
    }
    issues(
      types: $types
      state: $state
      authorUsername: $authorUsername
      labelName: $labelName
      search: $search
      sort: $sortBy
      first: $firstPageSize
      last: $lastPageSize
      after: $nextPageCursor
      before: $prevPageCursor
    ) {
      nodes {
        id
        iid
        title
        description
        createdAt
        updatedAt
        webUrl
        type
        author {
          ...Author
        }
        labels {
          nodes {
            ...Label
          }
        }
      }
      pageInfo {
        ...PageInfo
      }
    }
  }
}
